#coding=utf-8
from django import template
from django.http import HttpResponse
from django.http import HttpRequest
from django.shortcuts import render_to_response
from weibofactory.getWeiBo import  SinaWeibo
from web.models import ManageContent

def get_mdetail(request,kw):
        sinat = SinaWeibo("13938855952","weibo131421")
        sinat.basicAuth()
        user = sinat.get_myself()
        result = sinat.trends_statuses(kw)
        movie=ManageContent.objects.select_related().get(mtitle=kw)
        user_profile=request.session.get('user_profile', None)
        return render_to_response("sinaweibo/movie.html",{'result':result,'user':user,'movie':movie,'user_pr':user_profile})
def get_mlist(request):
    movie_list=ManageContent.objects.order_by('-id')
    user_profile=request.session.get('user_profile', None)
    return render_to_response("sinaweibo/index.html",{'movie_list':movie_list,'user_pr':user_profile})

def get_tread(request,tread):
        sinat = SinaWeibo("13938855952","weibo131421")
        sinat.basicAuth()
        user = sinat.get_myself()
        result = sinat.trends_statuses(tread)
        return render_to_response("sinaweibo/weibo.html",{'result':result,'user':user})
    
    